package L1;

import java.io.IOException;
import java.util.Scanner;

public class _088 {
    /**
     * 静静的推荐
     */
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int S = scanner.nextInt();
        int sum=0;
        int[] arr = new int[291];

        for (int i=0;i<N;i++){
            int T = scanner.nextInt();
            int P = scanner.nextInt();
            if (T<175){
                continue;
            }
            if (T>=175&&P>=S){
                sum++;
            }else {
                if (arr[T]<K){
                    arr[T]++;
                    sum++;
                }
            }
        }

        System.out.println(sum);
    }
}
